package org.reach.springframework.factory.support;

import org.reach.springframework.factory.config.BeanDefinition;
import org.reach.springframework.factory.config.SingletonBeanRegistry;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author 尹志远
 * @desc
 * @Date 2024/2/4 13:11
 */
public class DefaultSingletonBeanFactory implements SingletonBeanRegistry {

    private Map<String, Object> beanContainer = new ConcurrentHashMap<>();

    @Override
    public Object getSingleton(String name) {
        return beanContainer.get(name);
    }

    protected void addSingleton(String beanName, Object singletonObject) {
        beanContainer.put(beanName, singletonObject);
    }
}
